function PlotSpecial(aedat)

%{
Takes 'aedat' - a data structure containing an imported .aedat file, 
as created by ImportAedat, and creates a plots of special events,
where the x axis is time and the y axis is special event type.
%}

figure
hold all
times = double(aedat.data.special.timeStamp)' / 1000000;
addresses = single(aedat.data.special.address)';
plot([times; times], [addresses - 0.4; addresses + 0.4], 'b')
xlabel('Time (s)')
set(gca,'YDir','reverse')
	
set(gca, 'YTick', 0:17, 'YTickLabel', ...
{'0: TIMESTAMP_WRAP' ...
'1: TIMESTAMP_RESET' ...
'2: EXTERNAL_INPUT_RISING_EDGE' ...
'3: EXTERNAL_INPUT_FALLING_EDGE' ...
'4: EXTERNAL_INPUT_PULSE' ...
'5: DVS_ROW_ONLY' ...
'6: EXTERNAL_INPUT1_RISING_EDGE' ...
'7: EXTERNAL_INPUT1_FALLING_EDGE' ...
'8: EXTERNAL_INPUT1_PULSE' ...
'9: EXTERNAL_INPUT2_RISING_EDGE' ...
'10: EXTERNAL_INPUT2_FALLING_EDGE' ...
'11: EXTERNAL_INPUT2_PULSE' ...
'12: EXTERNAL_GENERATOR_RISING_EDGE' ...
'13: EXTERNAL_GENERATOR_FALLING_EDGE' ...
'14: APS_FRAME_START' ...
'15: APS_FRAME_END' ...
'16: APS_EXPOSURE_START' ...
'17: APS_EXPOSURE_END'})

